<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动的影响</title>
    <style>
    ul{
        padding: 0px;
        width: 1200px;
        /* height: 200px; */
        border: 1px solid paleturquoise;
        margin: 0 auto;
    }
    ul li{
        list-style: none;
        width: 200px;
        height: 200px;
        background: palevioletred;
        float: left;
        margin: 0 20px;
    }
    .overflow{
        overflow: hidden;
    }
    .clear{
        clear: both;
    }
    .clearfix::before{
        content: "111";
        display: block;
    }
    .clearfix::after{
        content: "";
        display: block;
        clear: both;
    }
    ol{
        padding: 0px;
        width: 1200px;
        border: 1px solid paleturquoise;
    }
    ol li{
        list-style: none;
        width: 200px;
        height: 200px;
        background: palevioletred;
        float: left;
        margin: 0 20px;
    }
    .center{
        position: relative;
        left: 50%;
        margin-left: -600px;
    }
    </style>
</head>
<body>
    <h2>通过给父级元素设置溢出影藏overflow: hidden;实现自己获取高度</h2>
    <ul class="overflow">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
    <h2>在最后一个子元素后面加上一个块级元素，并设置clear:both;</h2>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <div class="clear"></div>
    </ul>
    <h2>使用伪元素的后置设置clear:both;</h2>
    <ul class="clearfix">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
    <h2>使用定位计算居中</h2>
    <ol class="center clearfix">
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ol>
</body>
</html>